# include <bits/stdc++.h>
using namespace std;

char buf[1 << 18], *fs, *ft;
inline char getc() {
	return (fs == ft && (ft = (fs = buf) + fread(buf, 1, 1 << 18, stdin)), fs == ft) ? EOF : *fs++;
}

inline int gn() {
	int k = 0, f = 1;
	char c = getchar();
	for(; !isdigit(c); c = getc()) if(c == '-') f = -1;
	for(; isdigit(c); c = getc()) k = k * 10 + c - '0';
	return k * f;
}

int n, m[2523], f[2523];

int main() { 
# ifndef LOCAL
	freopen("cowriver.in", "r", stdin);
    freopen("cowriver.out", "w", stdout);
# else 
    freopen("in", "r", stdin);
# endif
	n = gn();
	m[0] = gn();
	for(int i = 1; i <= n; i++) m[i] = gn() + m[i - 1];
    for(int i = 1; i <= n; i++) { 
		f[i] = m[i];//???
        for(int j = 1; j << 1 <= i; j++) { 
            f[i] = min(f[i], f[j] + f[i - j] + m[0]);
        }
    }
    printf("%d\n", f[n]);
}
